<template>
    <div class="app-container calendar-list-container">
      <el-button
        icon="el-icon-circle-plus-outline"
        type="button"
        class="el-button el-button--primary"
        @click="toAddprocess"
        style="margin-bottom: 20px"
        v-if="userInfo.roleId != '30' && userInfo.roleId != '37'"
        >
        录入产品工艺路线</el-button>
      <div class="filter-container" v-if="userInfo.roleId != '30' && userInfo.roleId != 37">
        <el-input
              @keyup.enter.native="addProcessBtn"
              clearable
              v-model="technologyNo"
              style="width: 160px;margin-right:15px;margin-top:7px"
              class="filter-item"
              placeholder="请输入产品编号"
        ></el-input>
        <el-button class="filter-item" :loading="loadingBtn" type="primary" v-waves icon="el-icon-plus" @click="addProcessBtn">添加</el-button>
      </div>

      <!-- 查询工艺路线列表 -->
      <div class="filter-container">
        <el-input
              @keyup.enter.native="getData"
              clearable
              v-model="listQuery.technologyNo"
              style="width: 160px;margin-right:15px;margin-top:7px"
              class="filter-item"
              placeholder="请输入产品编号"
        ></el-input>
        <el-input
              @keyup.enter.native="getData"
              clearable
              v-model="listQuery.technologyEnd"
              style="width: 160px;margin-right:15px;margin-top:7px"
              class="filter-item"
              placeholder="末端产品编号"
        ></el-input>
        <el-input
              @keyup.enter.native="getData"
              clearable
              v-model="listQuery.processNo"
              style="width: 150px;margin-right:15px;margin-top:7px"
              class="filter-item"
              placeholder="请输入工序编号"
        ></el-input>
        <el-input
              @keyup.enter.native="getData"
              clearable
              v-model="listQuery.processName"
              style="width: 150px;margin-right:15px;margin-top:7px"
              class="filter-item"
              placeholder="请输入工序名称"
        ></el-input>
        <!-- 2022/3/28 15:04 关键字搜索，输入工作中心搜索改为选择工作中心 -->
        <!-- <el-select
              clearable
              v-model="listQuery.workCenter"
              placeholder="请选择工作中心"
              @focus="getCenterList"
              style="width: 150px;margin-right:15px;margin-top:7px"
              class="filter-item">
          <el-option :value="item" :label="item" v-for="(item,index) in this.centerList.data" :key="index"/>
        </el-select> -->

        <el-input
              @keyup.enter.native="getData"
              clearable
              v-model="listQuery.workCenter"
              style="width: 150px;margin-right:15px;margin-top:7px"
              class="filter-item"
              placeholder="请输入工作中心"
        ></el-input>
        <el-select
              clearable
              @keyup.enter.native="getData"
              v-model="listQuery.department"
              @focus="getDepartInfo"
              style="width: 150px;margin-right:15px;margin-top:7px"
              class="filter-item"
              placeholder="请输入员工部门" >
          <el-option :value="item" :label="item" v-for="(item,index) in this.departList" :key="index"/>
        </el-select>
        <!-- 对员工的职级进行查询 -->
        <el-cascader
              v-model="listQuery.jobClass"
              separator="-"
              :options="options"
              clearable
              placeholder="请输入职级"
              @keyup.enter.native="getData"
              style="width: 150px;margin-right:15px;margin-top:7px">
        </el-cascader>
        <el-select
            clearable
            @keyup.enter.native="getData"
            v-model="listQuery.isDelete"
            placeholder="审核是否通过"
            class="filter-item"
            style="width: 150px;margin-right:15px;margin-top:7px">
            <el-option
                v-for="(item,index) in optionsYS"
                :key="index"
                :label="item"
                :value="item">
            </el-option>
        </el-select>
        <el-button style="margin-top: 7px" class="filter-item" :loading="searchLoadingBtn" type="primary" v-waves icon="el-icon-search" @click="getData">搜索</el-button>
      </div>

      <!-- 工艺路线列表 -->
      <el-table :data="dealList" v-loading="listLoading" element-loading-text="拼命加载中"  stripe border fit highlight-current-ro style="width: 100%">
          <el-table-column  label="序号" type="index" align="center"/>
          <el-table-column  label="工序ID" prop="processId" align="center"/>
          <el-table-column  label="加工顺序" prop="processOrder" align="center"/>
          <el-table-column  label="产品编号" prop="technologyNo" align="center"/>
          <el-table-column  label="栈板数量" prop="palletCodeCount" align="center"/>
          <el-table-column  label="器件数量" prop="deviceCodeCount" align="center"/>
          <el-table-column  label="附件数量" prop="accessoryCodeCount" align="center"/>
          <el-table-column  label="工序编号" prop="processNo" align="center"/>
          <el-table-column  label="工序名称" prop="processName" align="center"/>
          <el-table-column  label="工作中心" prop="workCenter" align="center"/>
          <el-table-column  label="固定人时(M)" prop="manTime" align="center"/>
          <el-table-column  label="变动人时(M)" prop="manTimeFloat1" align="center"/>
          <el-table-column  label="部门" prop="department" align="center"/>
          <el-table-column  label="职级" prop="jobClass" align="center"/>
          <!-- 0删除（工艺经理未审核通过），1未删除（工艺经理已审核通过） -->
          <el-table-column  label="审核是否通过" align="center" width="160" v-if="userInfo.roleId != 30 && userInfo.roleId != 37">
            <template slot-scope="scope" >
              <el-switch
              v-model="scope.row.isDelete"
              active-text="是"
              inactive-text="否"
              @change="upDateProcess(scope.$index,scope.row)">
              </el-switch>
            </template>
          </el-table-column>
          <!-- 对工段进行修改与删除 -->
          <el-table-column  label="操作" fixed="right" align="center" width="160" v-if="userInfo.roleId != 30 && userInfo.roleId != 37">
            <template slot-scope="scope" >
              <el-button size="mini" type="primary" @click="handleEdit(scope.row)">设置</el-button>
              <el-button size="mini" type="danger" @click="handleDelete(scope.$index,scope.row)">删除</el-button>
            </template>
          </el-table-column>
      </el-table>

      <div slot="tip" class="el-upload__tip">提示：M指的是分钟,S指的是秒</div>

    <!-- 修改工艺信息弹出表单 -->
    <el-dialog title="工段信息修改" :visible.sync="dialogFormVisible" width="700px">
    <el-form :model="modifyform" :rules="rules" ref="modifyform">
      <el-form-item label="工序ID" :label-width="formLabelWidth">
        <el-input v-model="modifyform.processId" style="width:400px" disabled/>
      </el-form-item>
      <el-form-item label="加工顺序" :label-width="formLabelWidth">
        <el-input clearable v-model="modifyform.processOrder" style="width:400px"/>
      </el-form-item>
      <el-form-item label="工序名称" :label-width="formLabelWidth">
        <el-input clearable v-model="modifyform.processName" style="width:400px"/>
      </el-form-item>
      <el-form-item label="单价" :label-width="formLabelWidth" v-if="modifyform.workCenter == '喷涂车间'">
        <el-input v-model="modifyform.danjia" style="width:400px"/>
      </el-form-item>
      <el-form-item label="保护长度" :label-width="formLabelWidth" v-if="modifyform.workCenter == '喷涂车间'">
        <el-input v-model="modifyform.length" style="width:400px"/>
      </el-form-item>
      <el-form-item label="保护宽度" :label-width="formLabelWidth" v-if="modifyform.workCenter == '喷涂车间'">
        <el-input v-model="modifyform.wide" style="width:400px"/>
      </el-form-item>
      <el-form-item label="零件面积" :label-width="formLabelWidth" v-if="modifyform.workCenter == '喷涂车间'">
        <el-input v-model="modifyform.partArea" style="width:400px"/>
      </el-form-item>
      <el-form-item label="保护个数" :label-width="formLabelWidth" v-if="modifyform.workCenter == '喷涂车间'">
        <el-input v-model="modifyform.protectionNumber" style="width:400px"/>
      </el-form-item>
      <el-form-item label="固定人时(S)" :label-width="formLabelWidth">
        <el-input clearable v-model.number="modifyform.manTime" style="width:400px"/>
      </el-form-item>
      <el-form-item label="工作中心" :label-width="formLabelWidth" prop="workCenter">
      <el-select
          clearable
          v-model="modifyform.workCenter"
          placeholder="请选择工作中心"
          @focus="getCenterList"
          style="width:400px">
        <el-option :value="item" :label="item" v-for="(item,index) in this.centerList.data" :key="index"/>
      </el-select>
      </el-form-item>
      <el-form-item label="部门" :label-width="formLabelWidth">
        <el-select v-model="modifyform.department" placeholder="请选择该员工当前所在部门" @focus="getDepartInfo" style="width:400px">
          <el-option :value="item" :label="item" v-for="(item,index) in this.departList" :key="index"/>
        </el-select>
      </el-form-item>
      <el-form-item label="职级" :label-width="formLabelWidth">
        <el-cascader v-model="modifyform.jobClassStr" separator="-" :options="options" filterable clearable style="width:400px" />
      </el-form-item>
      <el-form-item label="标准工时(s)" :label-width="formLabelWidth" prop="manTimeFloat">
        <el-input clearable v-model.number="modifyform.manTimeFloat" placeholder="单位为秒的整数" style="width:400px"/>
      </el-form-item>
      <el-form-item label="重点工序" :label-width="formLabelWidth">
        <el-switch
          v-model="modifyform.proIsImport"
          active-text="是"
          inactive-text="否">
        </el-switch>
      </el-form-item>
      <el-form-item label="工艺说明" :label-width="formLabelWidth">
        <el-input
          clearable
          v-model="modifyform.remark"
          type="textarea"
          autosize
          style="width:400px"
        ></el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="dialogFormVisible = false">取 消</el-button>
      <el-button type="primary" @click="modifyProcess">确 定</el-button>
    </div>
    </el-dialog>

      <!-- pagination 分页 -->
      <div class="pagination-container">
        <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="listQuery.page"
          :page-sizes="[5,10, 20, 30, 40,100,300,500]"
          :page-size="listQuery.limit"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        ></el-pagination>
      </div>

    <el-divider></el-divider>
    <el-button style="margin-right: 10px" type="success" size="small" @click="hExportExcel">导出数据Excel</el-button>
    <el-button type="success" size="small" @click="getExcelList">下载Excel模板</el-button>
    <el-divider></el-divider>

    <!-- 上传Excel表单 -->
      <el-upload
        class="upload-demo"
        ref="upload"
        :action="baseURL+'/back/processJobClass/processExcel'"
        :on-preview="handlePreview"
        :on-remove="handleRemove"
        :on-success="handleSuccess"
        :on-error="handleError"
        :headers="httpHeader"
        :file-list="fileList"
        :show-file-list="showfilelist"
        :auto-upload="false"
        v-if="userInfo.roleId != 30 && userInfo.roleId != 37">
        <el-button slot="trigger" size="small" type="primary">选取工序文件</el-button>
        <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload" :loading="uploadLoading">{{uploadTip}}</el-button>
        <div slot="tip" class="el-upload__tip">将Excel表单从此处上传到服务器</div>
      </el-upload>
    </div>
</template>

<script>
import { addProcess, getProcessList, changeProcessRank, delProcess,upIsDelete} from '../../api/processRoute'
import {getCenter } from '../../api/workSection.js'
import { getRoleList,getDepartList } from '@/api/user'
import {uploadURL,baseURL,baseURL1} from '@/utils/baseURL'
import { getToken } from '@/utils/auth'
export default {
  name: 'ptadd_ProcessRoute',
    data() {
      return {
        uploadURL: uploadURL,
        baseURL: baseURL1,
        // 岗位职级下拉选项
        options: [{
          value: 'O1',
          label: 'O1',
          children: [{
            value: '1',
            label: '1'
          }, {
            value: '2',
            label: '2'
          }, {
            value: '3',
            label: '3'
          }, {
            value: '4',
            label: '4'
          }, {
            value: '5',
            label: '5'
          }]
        }, {
          value: 'O2',
          label: 'O2',
          children: [{
            value: '1',
            label: '1'
          }, {
            value: '2',
            label: '2'
          }, {
            value: '3',
            label: '3'
          }, {
            value: '4',
            label: '4'
          }, {
            value: '5',
            label: '5'
          }]
        }, {
          value: 'O3',
          label: 'O3',
          children: [{
            value: '1',
            label: '1'
          }, {
            value: '2',
            label: '2'
          }, {
            value: '3',
            label: '3'
          }, {
            value: '4',
            label: '4'
          }, {
            value: '5',
            label: '5'
          }]
        },  {
          value: 'O4',
          label: 'O4',
          children: [{
            value: '1',
            label: '1'
          }, {
            value: '2',
            label: '2'
          }, {
            value: '3',
            label: '3'
          }, {
            value: '4',
            label: '4'
          }, {
            value: '5',
            label: '5'
          }]
        }, {
          value: 'O5',
          label: 'O5',
          children: [{
            value: '1',
            label: '1'
          }, {
            value: '2',
            label: '2'
          }, {
            value: '3',
            label: '3'
          }, {
            value: '4',
            label: '4'
          }, {
            value: '5',
            label: '5'
          }]
        }],
        technologyNo: '',                                               //产品编号——添加时使用
        listQuery: {
          technologyNo: '',                                             //产品编号
          processNo: '',                                                //工序编号
          processName: '',                                              //工序名称
          workCenter: '',                                               //工作中心
          department: '',                                               //部门
          jobClass: [],                                                 //职级
          page: 1,                                                      //页码
          limit: 10                                                     //每页默认信息条数
        },
        modifyform: {                                                   //工段信息修改表单
          processId: '',                                                //工序ID
          department: '',                                               //部门
          jobClassStr: [],                                               //职级
          manTimeFloat: '',
          technologyNo: '',                                               //品号
          proIsImport: '',                                                    //是否重点工序  0非重点  1重点
          processOrder: '',
          processName: '',
          manTime: '',
          workCenter: '',
          remark: ''
        },
        dealList: [],
        total: 0,                                                      //总的信息条目数
        dialogFormVisible: false,                                       //工段信息修改表单开启与关闭的条件
        formLabelWidth: '100px',                                        //工段信息修改表单输入框宽度
        departList: {},
        listLoading: false,                                             //工艺路线列表开启与关闭的条件
        loadingBtn: false,
        searchLoadingBtn: false,
        httpHeader: {
            'Authorization': ''
        },
        centerList: '',                       //获取工作中心的列表
        rules: {},
        userInfo: this.$store.state.user.userInfo,
        uploadLoading: false,
        uploadTip:'上传到服务器',
        showfilelist: true,
        optionsYS: ['否','是'],
      }
    },
    methods: {
      toAddprocess() {
        this.$router.push({
            path: 'addProcessRoute1',
            name: 'addProcessRoute1',
            params: {data: ''}
        })
      },
      // 获取工作中心
      async getCenterList() {
        let query = {}
        query.isSpray = true
        const data = await getCenter()
        this.centerList = data
      },
    submitUpload() {
      this.uploadLoading = true
      this.uploadTip = '正在上传中'
      this.showfilelist = false
      // this.httpHeader.Authorization = this.dealCookie(document.cookie)
      this.httpHeader.Authorization = getToken()
      this.$refs.upload.submit()

    },
    // cookies的处理函数
    dealCookie(value) {
        const cookieArr = value.split('=')
        // 测试服使用cookieArr[2]
        return cookieArr[1]
    },
    handleError(){
      this.uploadLoading = false
      this.showfilelist = true
      this.uploadTip = '上传到服务器'
      this.$message({
        type: 'error',
        message: '上传失败!'
      })
    },
    handleSuccess(response) {
       console.log(response,'response')
       const result = response.code
       const errMsg = response.msg
       this.uploadLoading = false
       this.showfilelist = true
       this.uploadTip = '上传到服务器'
       this.$refs['upload'].clearFiles()
        if(result == '1'){
            this.$message({
              type: 'succes',
              message: errMsg
          })
          this.handleFilter()
        }else{
            this.$message({
              type: 'error',
              message: errMsg
        })
      }
    },
    handleRemove(file, fileList) {
      console.log(file, fileList);
    },
    handlePreview(file) {
      console.log(file);
    },
    // 添加工艺路线函数
    async addProcessBtn() {
      this.loadingBtn = true
      const data = await addProcess({technologyNo: this.technologyNo,isSpray: true})
      const errMsg = data.msg
      if(data.code == '1'){
        this.$message({
          message: '添加成功',
          type: 'success'
        })
        this.listQuery.technologyNo = this.technologyNo                     // 实现功能：当添加工艺路线时，点击添加直接呈现添加的工艺路线，方便用户修改
        this.listQuery.technologyEnd = this.technologyNo
        this.handleFilter()
      } else if (data.code == '2'){
          this.$message({
          message: data.msg,
          type: 'warning'
        })
      }
      this.loadingBtn = false
    },
    // 获取工艺路线列表,搜索按钮绑定函数
    async handleFilter() {
      this.searchLoadingBtn = true
      this.listLoading = true
      let query = Object.assign({}, this.listQuery)
      // 对职级数组进行处理之前先对jobClass数组做判断
      if(this.listQuery.jobClass.length == 0){
        query.jobClass = ''
      } else {
        query.jobClass = this.listQuery.jobClass.join('-')
      }
      if(this.listQuery.isDelete){ query.isDelete = this.listQuery.isDelete == '是'?'1':'0' }
      query.isSpray = true
      const {data} = await getProcessList(query)
      console.log(1212,data);
      this.dealList = data.records
      this.dealList.forEach(item => {
        item.isDelete = item.isDelete == '1'?true:false
        item.manTime = (item.manTime/60).toFixed(2)
      });
      this.total = data.total
      this.listLoading = false
      this.searchLoadingBtn = false
    },
    // 点击修改按钮，将table表的内容传入弹框内部的表单
    // item为一行的表单数据，为一个对象
    //item中的jobClassStr值存在两种情况：第一种是null，另一种为字符串
    handleEdit(item) {
      this.modifyform.processId = item.processId
      this.modifyform.department = item.department
      this.modifyform.manTimeFloat = item.manTimeFloat?item.manTimeFloat:''
      this.modifyform.technologyNo = item.technologyNo
      this.modifyform.processOrder = item.processOrder
      this.modifyform.processName = item.processName
      this.modifyform.manTime = parseInt(item.manTime*60)
      this.modifyform.workCenter = item.workCenter
      this.modifyform.remark = item.remark
      this.modifyform.proIsImport = item.proIsImport?true:false
      this.$set(this.modifyform, 'danjia', item.danjia)
      this.$set(this.modifyform, 'length', item.length)
      this.$set(this.modifyform, 'partArea', item.partArea)
      this.$set(this.modifyform, 'wide', item.wide)
      this.$set(this.modifyform, 'protectionNumber', item.protectionNumber)
      if(item.jobClass == null) {                                //当jobClass为空时，修改表单的职级赋予一个空数组
        this.modifyform.jobClassStr = []
      } else {
        this.modifyform.jobClassStr = item.jobClass.split('-')
      }
      this.dialogFormVisible = true
    },
    handleDelete(index,row) {
      this.$confirm('这将会永久删除该行数据，是否继续?', '警告', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
        }).then(async () => {
          let res = await delProcess({processId: row.processId,isSpray: true})
          this.dealList.splice(index, 1)
          this.$message({
            type: 'success',
            message: '删除成功'
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          })
        })
    },
    // 工艺经理审核通过
    upDateProcess(index,row){
      console.log(this.userInfo)
      if(this.userInfo.roleId == 0 || this.userInfo.roleId == 14 || this.userInfo.roleId == 27){
        let msg = ''
        if(!row.isDelete) {
          msg = '确定修改审核结果为【不通过】?'
        } else {
          msg = '确定工艺信息无误?'
        }
        this.$confirm(msg, '警告', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
          }).then(async () => {
            let data = await upIsDelete({technologyNo: row.technologyNo,isDelete: row.isDelete?'1':'0',isSpray: true})
            let errmsg = data.msg
            if(data.code == '1'){
              this.handleFilter()
              this.$message({
                type: 'success',
                message: errmsg
              })
            } else {
              this.$message({
                type: 'warning',
                message: errmsg
              })
            }
          }).catch(() => {
            this.dealList[index].isDelete = !this.dealList[index].isDelete
            this.$message({
              type: 'info',
              message: '已取消'
            })
          })
      } else {
        this.$message({
          message: '请联系工艺经理进行处理！',
          type: 'warning'
        })
        this.dealList[index].isDelete = !this.dealList[index].isDelete
      }
    },
    // 获取部门函数
    async getDepartInfo() {
        let query = {}
        query.isSpray = true
        let {data} = await getDepartList(query)
        this.departList = data
    },
      // 将弹框修改后的工段信息传入后台，并且消息提示是否修改成功
      // 当职级与部门都为空需要添加时，只添加一个是无法成功提交的
      async modifyProcess() {
        let query = {
          processId: this.modifyform.processId,
          department: this.modifyform.department,
          technologyNo: this.modifyform.technologyNo,
          manTimeFloat: this.modifyform.manTimeFloat,
          proIsImport: this.modifyform.proIsImport?'1':'0',
          processOrder: this.modifyform.processOrder,
          processName: this.modifyform.processName,
          manTime: this.modifyform.manTime,
          workCenter: this.modifyform.workCenter,
          remark: this.modifyform.remark,
          danjia: this.modifyform.danjia,
          length: this.modifyform.length,
          wide: this.modifyform.wide,
          partArea: this.modifyform.partArea,
          protectionNumber: this.modifyform.protectionNumber
        }
        if(this.modifyform.jobClassStr.length == 0) {
          query.jobClass = ''
        } else {
          query.jobClass = this.modifyform.jobClassStr.join('-')
        }
        query.isSpray = true
        const data = await changeProcessRank(query)
        let msg = data.msg
        this.dialogFormVisible = false
        if(data.code == '1'){
          this.$message({
            message: msg,
            type: 'success'
          })
          this.handleFilter()
        } else {
          this.$message({
            message: msg,
            type: 'warning'
          })
        }
      },
      getData() {
        this.listQuery.page = 1
        this.listQuery.limit = 10
        this.handleFilter()
      },
      handleSizeChange(val) {
        this.listQuery.limit = val
        this.handleFilter()
      },
      handleCurrentChange(val) {
        this.listQuery.page = val
        this.handleFilter()
      },
      // 下载模板表单
      getExcelList() {
        window.open('http://180.76.113.62:8110/image/portrait/example1.rar')
      },
      transformDat(res) {
      const mapInfo = {
        processId: '工序ID',
        processOrder: '加工顺序',
        technologyNo: '产品编号',
        processNo: '工序编号',
        processName: '工序名称',
        workCenter: '工作中心',
        manTime: '固定人时(M)',
        manTimeFloat1: '变动人时(M)',
        department: '部门',
        jobClass: '职级',
        isDelete: '审核是否通过',
        remark: '工艺说明'
      }
      // 对data进行格式化
      // 取出所有的属性名
      const props = Object.keys(res[0]) // ['id','']
      console.log(props)
      // 将属性名从英文转为中文
      const header = props.map(zhkey => mapInfo[zhkey])
      console.log('中文的表头', header)
      // const data=[['xxxx','总裁办'，'13800000']]
      const data = res.map(obj => Object.values(obj))
      console.log(data)
      return { header, data }
    },
    // 导出excel
    async hExportExcel() {
      this.loading = true
      let query = Object.assign({},this.listQuery)
      // 对职级数组进行处理之前先对jobClass数组做判断
      if(this.listQuery.jobClass.length == 0){
        query.jobClass = ''
      } else {
        query.jobClass = this.listQuery.jobClass.join('-')
      }
      query.page = 1
      query.limit = 10000
      console.log('%c导出excel传的参数query:','color:green;font-size:16px;')
      console.log(query)
      query.isSpray = true
      let arr = await getProcessList(query)
      if(arr.code != '1') return  this.$message.error(arr.msg)
      const { header, data } = this.transformDat(this.setSort(arr.data.records))
      import('@/vendor/Export2Excel').then(excel => {
        // excel表示导入的模块对象
        console.log(excel)
        excel.export_json_to_excel({
        header, // 表头 必填
        data, // 具体数据 必填
        filename: '工艺新增搜索修改-excel', // 文件名称
        autoWidth: true, // 宽度是否自适应
        bookType: 'xlsx' // 生成的文件类型
        })
      })
      this.loading = false
    },
    // 排序函数
    setSort(arr){
      let newArr = JSON.parse(JSON.stringify(arr))
      let arr1 = []
      newArr.forEach((item)=>{
        let obj = {
          processId: item.processId,
          processOrder: item.processOrder,
          technologyNo: item.technologyNo,
          processNo: item.processNo,
          processName: item.processName,
          workCenter: item.workCenter,
          manTime: item.manTime,
          manTimeFloat1: item.manTimeFloat1,
          department: item.department,
          jobClass: item.jobClass,
          isDelete: item.isDelete == '1'?'是':'否',
          remark: item.remark
      }
      arr1.push(obj)
      })
      return arr1
    },
    },
    // 在生命周期函数调用"搜索"按钮绑定的函数，显示已有的数据
    mounted() {
      this.handleFilter()
    }
}
</script>

<style>

</style>
